import request from "@/utils/request";
/******* 数据源*****/
// 获取分页列表
export function getDataSourcePageList(params) {
  return request({
    url: "/src/list",
    method: "get",
    params,
  });
}
// 详情
export function getDataSourceDetail(id) {
  return request({
    url: `/src/detail/${id}`,
    method: "get",
  });
}
// 新增
export function createDataSource(data) {
  return request({
    url: "/src/add",
    method: "post",
    data,
  });
}
// 修改
export function updateDataSource(data) {
  return request({
    url: `/src/modify/${data.id}`,
    method: "put",
    data,
  });
}
// 删除
export function deleteDataSource(id) {
  return request({
    url: `/src/delete/${id}`,
    method: "delete",
  });
}

// 测试
export function testConnect(data) {
  return request({
    url: `/src/testConnection`,
    method: "post",
    data,
  });
}

/******* 节点管理*****/
// 获取分页列表
const baseURL = "/server-proxy";

export function getNodePageList(params) {
  return request({
    baseURL,
    url: "/node/list",
    method: "get",
    params,
  });
}
// 详情
export function getNodeDetail(id) {
  return request({
    baseURL,
    url: `/node/detail/${id}`,
    method: "get",
  });
}
// 新增
export function createNode(data) {
  return request({
    baseURL,
    url: "/node/add",
    method: "post",
    data,
  });
}
// 修改
export function updateNode(data) {
  return request({
    baseURL,
    url: `/node/modify/${data.id}`,
    method: "put",
    data,
  });
}
// 删除
export function deleteNode(id) {
  return request({
    baseURL,
    url: `/node/delete/${id}`,
    method: "delete",
  });
}

/****认证管理 ****/

export function getAuthPageList(params) {
  return request({
    url: "/auth/plugin",
    method: "get",
    params,
  });
}
// 详情
export function getAuthDetail(id) {
  return request({
    url: `/auth/plugin/${id}`,
    method: "get",
  });
}
// 新增
export function createAuth(data) {
  return request({
    url: "/auth/plugin",
    method: "post",
    data,
  });
}
// 修改
export function updateAuth(data) {
  return request({
    url: `/auth/plugin/${data.id}`,
    method: "put",
    data,
  });
}
// 删除
export function deleteAuth(id) {
  return request({
    url: `/auth/plugin/${id}`,
    method: "delete",
  });
}
// 测试连接
export function ifcallVersion(data) {
  return request({
    url: "/auth/plugin/test",
    method: "post",
    data,
  });
}
// 根据认证id获取服务列表
export function getSvcByAuthId(params) {
  return request({
    url: `/auth/plugin/${params.id}/svc/list`,
    method: "get",
    params
  });
}
// 文件上传
export function uploadAuthSDK(data) {
  return request({
    url: "/auth/plugin/upload",
    method: "post",
    data,
  });
}
